package com.appkubes.fintech.restful.application.user.dao;

import com.appkubes.fintech.core.pojo.FintechUserMapper;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Update;
import org.springframework.stereotype.Repository;

@Repository
public interface UserDao extends FintechUserMapper {

    @Insert("insert into fintech_user(user_key, is_base_info) value(#{userKey}, #{isBaseInfo})")
    Integer updateBaseUserInfo(@Param("userKey") String userKey, @Param("isBaseInfo") Integer isBaseInfo);

    @Update("UPDATE mall_promoter p INNER JOIN mall_user_hierarchy h ON p.`promoter_key` = h.`promoter_key` SET p.`statis_auth_count` = p.`statis_auth_count` + 1 WHERE h.`user_key`= #{userKey}")
    Integer updateStatisAuthCount(@Param("userKey")String userKey);
}
